import java.util.Objects;

public class Test3 {
    public static void main(String[] args) {
//        String str1="124";
//        String str2="124";
//        System.out.println(str1.equals(str2));
//        System.out.println("str1:"+str1.hashCode());
//        System.out.println("str2:"+str2.hashCode());
//        System.out.println("-------------------");
        Student stu1=new Student(1,2);
        Student stu2=new Student(1,2);
        System.out.println(stu1.equals(stu2));
        System.out.println("stu1:"+stu1.hashCode());
        System.out.println("stu2:"+stu2.hashCode());

    }
}

class Student{
    int a;
    int b;
    public Student(int a,int b){
        this.a=a;
        this.b=b;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return a == student.a && b == student.b;
    }

    @Override
    public int hashCode() {
        return Objects.hash(a, b);
    }
}